**	File name: ReplicationCode.do

**	Author: Ryan Black, Tim Johnson, Ryan Owens, Justin Wedeking. Contact Ryan (rcblack@msu.edu) with any questions or issues.

**	Creation Date: 12/14/22

***************************
***** BEGIN CODE USED *****
***************************

cd "/Users/rcb/Dropbox/OA TV/Data/"

***************************************
** Experiment 1 Main Article Content **
***************************************

use "Replication-Exp1.dta", clear

** Table of regression results
fracreg probit irtLegit5 i.numExpCond
est sto MB

** Medium Effects for Neutral Exchanges
est res MB
margins, at(numExpCond = 1)
matrix A = r(b)
local CV = A[1,1]
local CVT = `CV' + 0.005
est res MB
margins, at(numExpCond = (2 4 6 8)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(2 "Audio" 4 "Video" 6 "Audio" 8 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(1 9)) xlab(3 "Indiana" 7 "Minnesota", notick labgap(.35in) labsize(medium)) title("Neutral Exchanges") text(0.49 3 "Audio < Video" "(p = 0`A')") text(0.49 7 "Audio > Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 2 "Control Group", col(gs10))
graph export "PF-Medium_NonCont.pdf", as(pdf) replace

** Medium Effects for Contentious Exchanges
est res MB
margins, at(numExpCond = (3 5 7 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
local CVT = `CV' + 0.003
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(3 "Audio" 5 "Video" 7 "Audio" 9 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(2 10)) xlab(4 "Indiana" 8 "Minnesota", notick labgap(.35in) labsize(medium)) title("Contentious Exchanges") text(0.50 4 "Audio > Video" "(p = 0`A')") text(0.50 8 "Audio < Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 4 "Control Group", col(gs10))
graph export "PF-Medium_Cont.pdf", as(pdf) replace

** Style effects
est res MB
margins, at(numExpCond = (4 5 8 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
est res MB
mgen, at(numExpCond = (4 5 8 9))
egen xpts = seq() if _numExpCond != .
local CVT = `CV' + 0.004
twoway (rspike _ll _ul xpts, sort lcolor(black)) (scatter _margin xpts, msym(O) mcol(black) msize(6-pt)), xmlabel(1 "Neutral " 2 "Contentious" 3 "Neutral " 4 "Contentious", notick labsize(medium) angle(45)) xsc(r(0.5 4.5))  ytitle("Legitimacy Score") xtitle("")  xlab(1.5 "Dynamic" 3.5 "Static", notick labgap(0.9in) labsize(medium)) title("Video Presentational Style") legend(off) text(0.50 1.5 "p = 0`A'") text(0.50 3.5 "p = 0`B'")  yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 1.5 "Control Group", col(gs10))
graph export "PF-VideoStyle.pdf", as(pdf) replace

************************************************
** Experiment 1: Supporting Materials Content **
************************************************

** Control Variables
use "Replication-Exp1.dta", clear
fracreg probit irtLegit5 i.numExpCond age i.race4 hispanic_binary i.educ5 
est sto WC
margins, at(numExpCond = 1)
matrix A = r(b)
local CV = A[1,1]
local CVT = `CV' + 0.005
est res WC
margins, at(numExpCond = (2 4 6 8)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(2 "Audio" 4 "Video" 6 "Audio" 8 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(1 9)) xlab(3 "Indiana" 7 "Minnesota", notick labgap(.35in) labsize(medium)) title("Neutral Exchanges") text(0.49 3 "Audio < Video" "(p = 0`A')") text(0.49 7 "Audio > Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 2 "Control Group", col(gs10))
graph export "Medium_NonCont-WC.pdf", as(pdf) replace

est res WC
margins, at(numExpCond = (3 5 7 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
local CVT = `CV' + 0.003
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(3 "Audio" 5 "Video" 7 "Audio" 9 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(2 10)) xlab(4 "Indiana" 8 "Minnesota", notick labgap(.35in) labsize(medium)) title("Contentious Exchanges") text(0.50 4 "Audio > Video" "(p = 0`A')") text(0.50 8 "Audio < Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 4 "Control Group", col(gs10))
graph export "Medium_Cont-WC.pdf", as(pdf) replace

est res WC
margins, at(numExpCond = (4 5 8 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
est res WC
mgen, at(numExpCond = (4 5 8 9))
egen xpts = seq() if _numExpCond != .
local CVT = `CV' + 0.004
twoway (rspike _ll _ul xpts, sort lcolor(black)) (scatter _margin xpts, msym(O) mcol(black) msize(6-pt)), xmlabel(1 "Neutral " 2 "Contentious" 3 "Neutral " 4 "Contentious", notick labsize(medium) angle(45)) xsc(r(0.5 4.5))  ytitle("Legitimacy Score") xtitle("")  xlab(1.5 "Dynamic" 3.5 "Static", notick labgap(0.9in) labsize(medium)) title("Video Presentational Style") legend(off) text(0.50 1.5 "p = 0`A'") text(0.50 3.5 "p = 0`B'")  yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 1.5 "Control Group", col(gs10))
graph export "VideoStyle-WC.pdf", as(pdf) replace

la def fortab 1 "Control" 2 "IN Audio Neutral" 3 "IN Audio Contentious" 4 "IN Video Neutral" 5 "IN Video Contentious" 6 "MN Audio Neutral" 7 "MN Audio Contentious" 8 "MN Video Neutral" 9 "MN Video Contentious", replace
la values numExpCond fortab
la var age "Age"
la def raceTab 1 "White" 2 "Black/African American" 3 "Other Race" 4 "Asian"
la values race4 raceTab
la var hispanic_binary "Hispanic"
la def eduTab 1 "High School or Less" 2 "Some College" 3 "Associate Degree" 4 "Bachelor Degree" 5 "Master Degree or More"
la values educ5 eduTab

estout MB WC using "Supp-Exp1Table.tex", label nobase cells(b(star fmt(%9.3f)) se(par)) starlevels(* 0.05) varlabels(_cons Constant) stats(N, fmt(%9.0g)) mlabels("(1)" "(2)") collabels(,none)  eqlabels("", none) style(tex) replace

** Sample demographics
use "Replication-Exp1.dta", clear
tab gender
tab nonwhite
sum age, d
sum income5,d
tab income5
tab hhi if income == 3
tab educ5
tab education if educ5 == 3
tab region
tab partyID3

** Randomization check for supplement
use "Replication-Exp1.dta", clear
mlogit gender i.numExpCond
logit nonwhite i.numExpCond
reg age i.numExpCond
mlogit income5 i.numExpCond
mlogit educ5 i.numExpCond
mlogit region i.numExpCond
mlogit partyID3 i.numExpCond

** Shirkers for supplement
use "Replication-Exp1.dta", clear
fracreg probit irtLegit5 i.numExpCond##c.irtShirk
est sto MS

** Medium Effects for Neutral Exchanges
est res MS
mgen, at(numExpCond = (2 4 6 8) irtShirk = (-.39 2.04))
margins, at(numExpCond = (2 4 6 8) irtShirk = (-.39 2.04)) post
margins, coeflegend
test _b[1bn._at] = _b[3._at]
local A = round(r(p), .01)
test _b[2._at] = _b[4._at]
local B = round(r(p), .01)
test _b[5._at] = _b[7._at]
local C = round(r(p), .01)
test _b[6._at] = _b[8._at]
local D = round(r(p), .01)
egen asdf = seq() in 1/8
egen asdf2 = seq(), by(_numExp)

local Y1 0.19
local Y2 =`Y1'-0.015
twoway (rspike _ul _ll asdf if asdf2 == 1, lcolor(black)) (scatter _margin asdf if asdf2 == 1, mcolor(black) msymbol(square)) (rspike _ul _ll asdf if asdf2 == 2, lcolor(black)) (scatter _margin asdf if asdf2 == 2, mcolor(black) msymbol(circle)),  xscale(range(0.5 8.5)) legend(on order(2 "Low Shirker" 4 "High Shirker"))  xlabel(2.5 "Indiana" 6.5 "Minnesota", noticks labgap(huge)) xmtick(1.5 "Audio" 3.5 "Video" 5.5 "Audio" 7.5 "Video", labels labsize(medsmall) noticks) xtitle("") ytitle("Legitimacy Score") text(`Y1' 2.5 "Diff. Low Shirk (p = 0`A')", justi(center) size(small)) text(`Y2' 2.5 "Diff. High Shirk (p = 0.80)", justi(center) size(small)) text(`Y1' 6.5 "Diff. Low Shirk (p = 0.56)", justi(center) size(small)) text(`Y2' 6.5 "Diff. High Shirk (p = 0.70)", justi(center) size(small))  xline(4.5, lp(dash) lcol(black)) title("Neutral Exchanges") ysc(range(0.16 0.55))
graph export "Medium_NonCont-Shirk.pdf", as(pdf) replace

** Medium Effects for Contentious Exchanges
drop asdf asdf2 _margin _ll _ul _irtShirk _numExpCond
est res MS
mgen, at(numExpCond = (3 5 7 9) irtShirk = (-.39 2.04))
margins, at(numExpCond = (3 5 7 9) irtShirk = (-.39 2.04)) post
margins, coeflegend
test _b[1bn._at] = _b[3._at]
local A = round(r(p), .01)
test _b[2._at] = _b[4._at]
local B = round(r(p), .01)
test _b[5._at] = _b[7._at]
local C = round(r(p), .01)
test _b[6._at] = _b[8._at]
local D = round(r(p), .01)
egen asdf = seq() in 1/8
egen asdf2 = seq(), by(_numExp)

local Y1 0.15
local Y2 =`Y1'-0.02
twoway (rspike _ul _ll asdf if asdf2 == 1, lcolor(black)) (scatter _margin asdf if asdf2 == 1, mcolor(black) msymbol(square)) (rspike _ul _ll asdf if asdf2 == 2, lcolor(black)) (scatter _margin asdf if asdf2 == 2, mcolor(black) msymbol(circle)),  xscale(range(0.5 8.5)) legend(on order(2 "Low Shirker" 4 "High Shirker"))  xlabel(2.5 "Indiana" 6.5 "Minnesota", noticks labgap(huge)) xmtick(1.5 "Audio" 3.5 "Video" 5.5 "Audio" 7.5 "Video", labels labsize(medsmall) noticks) xtitle("") ytitle("Legitimacy Score") text(`Y1' 2.5 "Diff. Low Shirk (p = 0.01)", justi(center) size(small)) text(`Y2' 2.5 "Diff. High Shirk (p = 0.91)", justi(center) size(small)) text(`Y1' 6.5 "Diff. Low Shirk (p = 0.32)", justi(center) size(small)) text(`Y2' 6.5 "Diff. High Shirk (p = 0.32)", justi(center) size(small))  xline(4.5, lp(dash) lcol(black)) title("Contentious Exchanges") ysc(range(0.12 0.55))
graph export "Medium_Cont-Shirk.pdf", as(pdf) replace

** Style effects
drop asdf asdf2 _margin _ll _ul _irtShirk _numExpCond
est res MS
mgen, at(numExpCond = (4 5 8 9) irtShirk = (-.39 2.04))
margins, at(numExpCond = (4 5 8 9) irtShirk = (-.39 2.04)) post
margins, coeflegend
test _b[1bn._at] = _b[3._at]
local A = round(r(p), .01)
test _b[2._at] = _b[4._at]
local B = round(r(p), .01)
test _b[5._at] = _b[7._at]
local C = round(r(p), .01)
test _b[6._at] = _b[8._at]
local D = round(r(p), .01)
egen asdf = seq() in 1/8
egen asdf2 = seq(), by(_numExp)

local Y1 0.18
local Y2 =`Y1'-0.02
twoway (rspike _ul _ll asdf if asdf2 == 1, lcolor(black)) (scatter _margin asdf if asdf2 == 1, mcolor(black) msymbol(square)) (rspike _ul _ll asdf if asdf2 == 2, lcolor(black)) (scatter _margin asdf if asdf2 == 2, mcolor(black) msymbol(circle)),  xscale(range(0.5 8.5)) legend(on order(2 "Low Shirker" 4 "High Shirker"))  xlabel(2.5 "Dynamic" 6.5 "Static", noticks labgap(huge)) xmtick(1.5 "Neutral" 3.5 "Conten." 5.5 "Neutral" 7.5 "Conten.", labels labsize(medsmall) noticks) xtitle("") ytitle("Legitimacy Score") text(`Y1' 2.5 "Diff. Low Shirk (p = 0.32)", justi(center) size(small)) text(`Y2' 2.5 "Diff. High Shirk (p = 0.30)", justi(center) size(small)) text(`Y1' 6.5 "Diff. Low Shirk (p = 0.62)", justi(center) size(small)) text(`Y2' 6.5 "Diff. High Shirk (p = 0.92)", justi(center) size(small))  xline(4.5, lp(dash) lcol(black)) title("Video Presentational Style") ysc(range(0.15 0.55))
graph export "VideoStyle-Shirk.pdf", as(pdf) replace

** Supplement content manipulation check
use "Replication-Exp1.dta", clear
foreach V in tjudgeProfess tjudgeVoteAtt tjudgeFair tjudgeConfid {
	ttest `V', by(contentious)
}
collapse (mean) tjudgeProfess tjudgeVoteAtt tjudgeFair tjudgeConfid, by(contentious)
drop if contentious == .
reshape long tj, i(contentious) string
gen asdf = 4 if _j == "udgeProfess"
replace asdf = 3 if _j == "udgeVoteAtty"
replace asdf = 2 if _j  == "udgeConfid"
replace asdf = 1 if _j  == "udgeFair"
graph hbar (asis) tj, over(contentious, relabel(1 "Neutral" 2 "Contentious")) over(_j, relabel(1 "Job Confidence" 2 "Future Fairness" 3 "Professional" 4 "Vote for Attorney") sort(asdf) descending) exclude0 bar(1, fcolor(gs8) lcolor(none)) ytitle("Level of Agreement" "(5 = Strongly Agree, 1 = Strongly Disagree)") ylabel(1(1)5)
graph export "ContentCheck.pdf", as(pdf) replace

** Supplement OLS robustness
use "Replication-Exp1.dta", clear

** Table of regression results
reg irtLegit5 i.numExpCond
est sto MB

** Medium Effects for Neutral Exchanges
est res MB
margins, at(numExpCond = 1)
matrix A = r(b)
local CV = A[1,1]
local CVT = `CV' + 0.005
est res MB
margins, at(numExpCond = (2 4 6 8)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(2 "Audio" 4 "Video" 6 "Audio" 8 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(1 9)) xlab(3 "Indiana" 7 "Minnesota", notick labgap(.35in) labsize(medium)) title("Neutral Exchanges") text(0.49 3 "Audio < Video" "(p = 0`A')") text(0.49 7 "Audio > Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 2 "Control Group", col(gs10))
graph export "Medium_NonCont-OLS.pdf", as(pdf) replace

** Medium Effects for Contentious Exchanges
est res MB
margins, at(numExpCond = (3 5 7 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
local CVT = `CV' + 0.003
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(3 "Audio" 5 "Video" 7 "Audio" 9 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(2 10)) xlab(4 "Indiana" 8 "Minnesota", notick labgap(.35in) labsize(medium)) title("Contentious Exchanges") text(0.50 4 "Audio > Video" "(p = 0`A')") text(0.50 8 "Audio < Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 4 "Control Group", col(gs10))
graph export "Medium_Cont-OLS.pdf", as(pdf) replace

** Style effects
est res MB
margins, at(numExpCond = (4 5 8 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .001)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .001)
est res MB
mgen, at(numExpCond = (4 5 8 9))
egen xpts = seq() if _numExpCond != .
local CVT = `CV' + 0.004
twoway (rspike _ll _ul xpts, sort lcolor(black)) (scatter _xb xpts, msym(O) mcol(black) msize(6-pt)), xmlabel(1 "Neutral " 2 "Contentious" 3 "Neutral " 4 "Contentious", notick labsize(medium) angle(45)) xsc(r(0.5 4.5))  ytitle("Legitimacy Score") xtitle("")  xlab(1.5 "Dynamic" 3.5 "Static", notick labgap(0.9in) labsize(medium)) title("Video Presentational Style") legend(off) text(0.50 1.5 "p = 0`A'") text(0.50 3.5 "p = 0`B'")  yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 1.5 "Control Group", col(gs10))
graph export "VideoStyle-OLS.pdf", as(pdf) replace
 
reg irtLegit5 i.numExpCond age i.race4 hispanic_binary i.educ5 
est sto WC
margins, at(numExpCond = 1)
matrix A = r(b)
local CV = A[1,1]
local CVT = `CV' + 0.005
est res WC
margins, at(numExpCond = (2 4 6 8)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(2 "Audio" 4 "Video" 6 "Audio" 8 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(1 9)) xlab(3 "Indiana" 7 "Minnesota", notick labgap(.35in) labsize(medium)) title("Neutral Exchanges") text(0.49 3 "Audio < Video" "(p = 0`A')") text(0.49 7 "Audio > Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 2 "Control Group", col(gs10))
graph export "Medium_NonCont-WC-OLS.pdf", as(pdf) replace

est res WC
margins, at(numExpCond = (3 5 7 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
local CVT = `CV' + 0.003
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(3 "Audio" 5 "Video" 7 "Audio" 9 "Video", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(2 10)) xlab(4 "Indiana" 8 "Minnesota", notick labgap(.35in) labsize(medium)) title("Contentious Exchanges") text(0.50 4 "Audio > Video" "(p = 0`A')") text(0.50 8 "Audio < Video" "(p = 0`B')") yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 4 "Control Group", col(gs10))
graph export "Medium_Cont-WC-OLS.pdf", as(pdf) replace

est res WC
drop _xb _ll _ul _numExpCond xpts
margins, at(numExpCond = (4 5 8 9)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
est res WC
mgen, at(numExpCond = (4 5 8 9))
egen xpts = seq() if _numExpCond != .
local CVT = `CV' + 0.004
twoway (rspike _ll _ul xpts, sort lcolor(black)) (scatter _xb xpts, msym(O) mcol(black) msize(6-pt)), xmlabel(1 "Neutral " 2 "Contentious" 3 "Neutral " 4 "Contentious", notick labsize(medium) angle(45)) xsc(r(0.5 4.5))  ytitle("Legitimacy Score") xtitle("")  xlab(1.5 "Dynamic" 3.5 "Static", notick labgap(0.9in) labsize(medium)) title("Video Presentational Style") legend(off) text(0.50 1.5 "p = 0`A'") text(0.50 3.5 "p = 0`B'")  yline(`CV', lp(dash) lcol(gs10)) text(`CVT' 1.5 "Control Group", col(gs10))
graph export "VideoStyle-WC-OLS.pdf", as(pdf) replace

la def fortab 1 "Control" 2 "IN Audio Neutral" 3 "IN Audio Contentious" 4 "IN Video Neutral" 5 "IN Video Contentious" 6 "MN Audio Neutral" 7 "MN Audio Contentious" 8 "MN Video Neutral" 9 "MN Video Contentious", replace
la values numExpCond fortab
la var age "Age"
la def raceTab 1 "White" 2 "Black/African American" 3 "Other Race" 4 "Asian"
la values race4 raceTab
la var hispanic_binary "Hispanic"
la def eduTab 1 "High School or Less" 2 "Some College" 3 "Associate Degree" 4 "Bachelor Degree" 5 "Master Degree or More"
la values educ5 eduTab

estout MB WC using "Supp-Exp1Table-OLS.tex", label nobase cells(b(star fmt(%9.3f)) se(par)) starlevels(* 0.05) varlabels(_cons Constant) stats(N, fmt(%9.0g)) mlabels("(1)" "(2)") collabels(,none)  eqlabels("", none) style(tex) replace


**********************************
** Experiment 2 Article Content **
**********************************

cd "/Users/rcb/Dropbox/OA TV/Data/"

use "Replication-Exp2.dta", clear

fracreg logit irtLegit5 i.numExpCond
est sto ModSym
margins, at(numExpCond = (1 2 3 4)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(1 "No Symbols" 2 "Symbols" 3 "No Symbols" 4 "Symbols", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(0.5 4.5)) xlab(1.5 "Neutral" 3.5 "Contentious", notick labgap(.35in) labsize(medium))  title("Dynamic Presentation: Content and Symbols") text(0.50 1.5 "p = 0`A'") text(0.50 3.5 "p = 0`B'")
graph export "PF-Symbols.pdf", as(pdf) replace

fracreg logit irtLegit5 i.numExpCond age i.race4 hispanic_binary i.educ5 i.gender
est sto ModSymWC
margins, at(numExpCond = (1 2 3 4)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(1 "No Symbols" 2 "Symbols" 3 "No Symbols" 4 "Symbols", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(0.5 4.5)) xlab(1.5 "Neutral" 3.5 "Contentious", notick labgap(.35in) labsize(medium))  title("Dynamic Presentation: Content and Symbols") text(0.51 1.5 "p = 0`A'") text(0.51 3.5 "p = 0`B'")
graph export "Symbols-WC.pdf", as(pdf) replace

la def expTab 1 "Neutral, No Symbols" 2 "Neutral, Symbols" 3 "Contentious, No Symbols" 4 "Contentious, Symbols"
la values numExpCond expTab
la var age "Age"
la def raceTab 1 "White" 2 "Black/African American" 3 "Other Race" 4 "Asian"
la values race4 raceTab
la var hispanic_binary "Hispanic"
la def eduTab 1 "High School or Less" 2 "Some College" 3 "Associate Degree" 4 "Bachelor Degree" 5 "Master Degree or More"
la values educ5 eduTab
la var gender "Gender"

estout ModSym ModSymWC using "Supp-Exp2Table.tex", label nobase cells(b(star fmt(%9.3f)) se(par)) starlevels(* 0.05) varlabels(_cons Constant) stats(N, fmt(%9.0g)) mlabels("(1)" "(2)") collabels(,none)  eqlabels("", none) style(tex) replace

** Sample demographics for the supplement
tab gender
tab nonwhite
sum age, d
sum income5,d
tab income5
tab hhi if income == 3
tab educ5
tab education if educ5 == 3
tab region
tab partyID3

** Randomization check for supplement
mlogit gender i.numExpCond
logit nonwhite i.numExpCond
reg age i.numExpCond
mlogit income5 i.numExpCond
mlogit educ5 i.numExpCond
mlogit region i.numExpCond
mlogit partyID3 i.numExpCond

** Shirkers for supplement
fracreg logit irtLegit5 i.numExpCond##c.irtShirk
est sto MS
mgen, at(numExpCond = (1 2 3 4) irtShirk = (-0.52 1.89))
margins, at(numExpCond = (1 2 3 4) irtShirk = (-0.52 1.89)) post
margins, coeflegend
test _b[1bn._at] = _b[3._at]
test _b[2._at] = _b[4._at]
test _b[5._at] = _b[7._at]
test _b[6._at] = _b[8._at]
egen asdf = seq() in 1/8
egen asdf2 = seq(), by(_numExp)
local Y1 0.18
local Y2 =`Y1'-0.02
twoway (rspike _ul _ll asdf if asdf2 == 1, lcolor(black)) (scatter _margin asdf if asdf2 == 1, mcolor(black) msymbol(square)) (rspike _ul _ll asdf if asdf2 == 2, lcolor(black)) (scatter _margin asdf if asdf2 == 2, mcolor(black) msymbol(circle)),  xscale(range(0.5 8.5)) legend(on order(2 "Low Shirker" 4 "High Shirker"))  xlabel(2.5 "Neutral" 6.5 "Contentious", noticks labgap(huge)) xmtick(1.5 "No Symbols" 3.5 "Symbols" 5.5 "No Symbols" 7.5 "Symbols.", labels labsize(medsmall) noticks) xtitle("") ytitle("Legitimacy Score") title("Dynamic Presentation: Content and Symbols") xline(4.5, lp(dash) lcol(black)) text(`Y1' 2.5 "Diff. Low Shirk (p = 0.38)", justi(center) size(small)) text(`Y2' 2.5 "Diff. High Shirk (p = 0.79)", justi(center) size(small)) text(`Y1' 6.5 "Diff. Low Shirk (p = 0.12)", justi(center) size(small)) text(`Y2' 6.5 "Diff. High Shirk (p = 0.64)", justi(center) size(small))  ysc(range(0.15 0.5))
graph export "Symbols-Shirk.pdf", as(pdf) replace
drop asdf asdf2 _margin _ll _ul _irtShirk _numExpCond
est res MS
margins, at(numExpCond = (3 4) irtShirk = (-0.52 -0.48 -0.2 0.3 0.33 0.34 0.37 0.49 0.53 0.67 0.7 0.83 0.87 0.9 1.03 1.15 1.18 1.18 1.22 1.31 1.34 1.57 1.69 1.75 1.89)) post
test _b[1bn._at] = _b[25._at]
forvalues I = 2(1)24 {
	local Z = `I'+24
	test _b[`I'._at] = _b[`Z'._at]
}
marginsplot, xdim(irtShirk)

use "Replication-Exp2.dta", clear
reg irtLegit5 i.numExpCond
est sto ModSym
margins, at(numExpCond = (1 2 3 4)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(1 "No Symbols" 2 "Symbols" 3 "No Symbols" 4 "Symbols", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(0.5 4.5)) xlab(1.5 "Neutral" 3.5 "Contentious", notick labgap(.35in) labsize(medium))  title("Dynamic Presentation: Content and Symbols") text(0.50 1.5 "p = 0`A'") text(0.50 3.5 "p = 0`B'")
graph export "Symbols-OLS.pdf", as(pdf) replace

reg irtLegit5 i.numExpCond age i.race4 hispanic_binary i.educ5 i.gender
est sto ModSymWC
margins, at(numExpCond = (1 2 3 4)) post
margins, coeflegend
test  _b[1bn._at] = _b[2._at]
local A = round(r(p), .01)
test  _b[3._at] = _b[4._at]
local B = round(r(p), .01)
marginsplot, recast(scatter) plotopts(mcolor(black) msize(6-pt)) recastci(rspike) ciopts(lcolor(black)) xmlabel(1 "No Symbols" 2 "Symbols" 3 "No Symbols" 4 "Symbols", notick labsize(medium)) ytitle("Legitimacy Score") xtitle("") xsc(r(0.5 4.5)) xlab(1.5 "Neutral" 3.5 "Contentious", notick labgap(.35in) labsize(medium))  title("Dynamic Presentation: Content and Symbols") text(0.51 1.5 "p = 0`A'") text(0.51 3.5 "p = 0`B'")
graph export "Symbols-WC-OLS.pdf", as(pdf) replace

la def expTab 1 "Neutral, No Symbols" 2 "Neutral, Symbols" 3 "Contentious, No Symbols" 4 "Contentious, Symbols"
la values numExpCond expTab
la var age "Age"
la def raceTab 1 "White" 2 "Black/African American" 3 "Other Race" 4 "Asian"
la values race4 raceTab
la var hispanic_binary "Hispanic"
la def eduTab 1 "High School or Less" 2 "Some College" 3 "Associate Degree" 4 "Bachelor Degree" 5 "Master Degree or More"
la values educ5 eduTab
la var gender "Gender"

estout ModSym ModSymWC using "Supp-Exp2Table-OLS.tex", label nobase cells(b(star fmt(%9.3f)) se(par)) starlevels(* 0.05) varlabels(_cons Constant) stats(N, fmt(%9.0g)) mlabels("(1)" "(2)") collabels(,none)  eqlabels("", none) style(tex) replace


*************************
***** END CODE USED *****
*************************


